@ECHO OFF
REM -- Usage: Make <target>...
REM -- E.g.:  Make deb
REM --
REM -- Each <target> may be:
REM --   all		Build everything (default)
REM --   deb		Build debug version
REM --   rel		Build release version
REM --   doc		Copies documentation to the drop location within the local source tree
REM --   getdsf		Copies documentation support files to DocFiles to simplify static file editing
REM --   ide		Open this solution in Visual Studio
REM --   clean		Delete built files
REM --   cleanall	Delete built files and IDE temporary files
REM --

REM -- location of the CodeDoc tool and its source code
SET CODEDOCSRC=..\..\..\CodeDoc
SET CODEDOCEXE=%CODEDOCSRC%\bin\Release\CodeDoc.exe

IF "%1"=="" Make.bat all
:loop
IF "%1"=="" EXIT /B 0
ECHO [%1]
GOTO %1

:all
CALL Make.bat deb rel
GOTO next

:deb
CALL ..\..\Misc\VsBuild LutronDriver.sln Debug bin\Debug\LutronDriver.dll
GOTO next

:rel
CALL ..\..\Misc\VsBuild LutronDriver.sln Release bin\Release\LutronDriver.dll
GOTO next

:doc
CALL %~nx0 getdsf
xcopy DocFiles ..\..\Drop\ServerDoc\Drivers\Lutron /i /s /y
GOTO next

:getdsf
copy %CODEDOCSRC%\SupportFiles\*.css DocFiles
GOTO next

:ide
start LutronDriver.sln
GOTO next

:clean
rmdir /s /q bin 2> nul
rmdir /s /q obj 2> nul
GOTO next

:cleanall
CALL Make.bat clean
del LutronDriver.csproj.user 2> nul
attrib -h -r LutronDriver.v11.suo > nul
del LutronDriver.v11.suo 2> nul
FOR %%f IN (%CODEDOCSRC%\SupportFiles\*.css) DO del DocFiles\%%~nxf
GOTO next

EXIT /B 0

:next
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
SHIFT
GOTO loop

